﻿@{
    ViewBag.Title = "XemHangBan";
    Layout = "~/Views/Shared/_Admin_Layout.cshtml";
}

@model CoffeeBar.Models.MatHangModels
<h2 style="width:100%; height:auto; margin:0 auto; text-align:center;">---XEM HÀNG BÁN---</h2>
<style>
    div#show-items 
    {
        width:100%;
        height:auto;
     }
    div#show-items ul
    {
        width:95%; 
        height:auto;
        margin: 0 auto;
       border:1px solid black;
     }
    div#show-items ul li
    {
        display:inline;         
      font-size:13px;
    }
</style>
<div id="show-items">
<ul>
<li style="width: 15%;float: left;margin-left: 0px;text-align:center;">Tác vụ    | </li>
<li style="width: 38%;margin-left: 50px;text-align:center;"> Tên Hàng Bán    |   </li>
<li style="width: 20%;margin-left: 150px;text-align:center;"> Thuộc Loại |   </li>
<li style="width: 20%;float: right;margin-right: 10px;text-align:center;"> Tình Trạng Sẵn Có  </li>
</ul>
@if (ViewData["dsHangBan"] != null)
{
    var items = ViewData["dsHangBan"] as List<CoffeeBar.Models.HangBan>;
    foreach (var item in items)
    {
        <ul>
        <li style="width: 20%;float: left;margin-left: 0px;"> @Html.ActionLink("Edit", "EditHangBan", new {  id=item.MaHang} ) |  
        @Html.ActionLink("Detail", "DetailHangBan", new {  id=item.MaHang} ) |
        @Html.ActionLink("Delete", "DeleteHangBan", new { id = item.MaHang }) </li>             
        <li style="width: 38%;margin-left: 30px;text-align:left;">@item.TenHang </li>
        <li style="width: 20%;float: right;margin-right: 10px; text-align:right">
         @if (item.SanCo > 0)
         {
                <input type=checkbox name="sanco" checked=checked value="Sẵn có" />
         }
         else
         {
                <input type=checkbox name="sanco" value="Sẵn có" />
         }
            </li>
        @if(ViewData["dsLoaiHang"] != null)
        {
            var dslh = ViewData["dsLoaiHang"] as List<CoffeeBar.Models.LoaiMatHang.LoaiHang>;
            foreach(var lh in dslh)
            {
                if(Convert.ToInt32(lh.maloaihang)==item.MaLoaihang)
                {
                    <li style="width:20%; margin-left: 40px;text-align:right; float:right; margin-right:10px;">@lh.tenloaihang</li>    
                }
            }
        }    
        
        </ul>
    }
}
</div>
<style>
    div#add-pro
    {
        width:90%;
        height:auto;
        margin: 0 auto;
        padding:5px;
    }
    div#add-pro p
    {
        padding-left: 20px;
    }
     div#add-pro p
    {
        
    }
    div#add-pro h2
    {
        width:80%;
        height:auto;
        margin: 0 auto;
        text-align:center;
    }
</style>
<div id="add-pro">
<h2>   THÊM HÀNG BÁN MỚI </h2>
@using (Html.BeginForm("ThemHangBan", "Quanlyhanghoa", FormMethod.Post))
{
    <p>@Html.LabelFor(m => m.TenHang) : 
    @Html.TextBoxFor(m => m.TenHang)
    Thuộc Loại : <select name="loaihangban">
    <option value="-1">---Chọn---</option>
        @if (ViewData["dsLoaiHang"] != null)
        {
            var items = ViewData["dsLoaiHang"] as List<CoffeeBar.Models.LoaiMatHang.LoaiHang>;
            foreach (var item in items)
            {
                <option value="@item.maloaihang">@item.tenloaihang</option>
            }
        }
</select>
    </p>
    <p>
    @Html.LabelFor(m => m.DonGia) : 
    @Html.TextBoxFor(m => m.DonGia)  -
   
    @Html.LabelFor(m => m.CoSan): 
    @Html.CheckBoxFor(m => m.CoSan)
    </p>
     <p>
    <div style="width:100%; height:auto;">
    <script type="text/javascript" src="../../Scripts/ckeditor/ckeditor.js" language="javascript"></script>
    <script type="text/javascript" language="javascript">
        window.onload = function () {            
        CKEDITOR.replace('txtgioithieu');
    }
</script> 
    <textarea id="txtgioithieu" name="txtgioithieu" rows="10" cols="40" ></textarea>
    </div>
    </p>
    <p>
    <input type="submit" name="submit" value=" Thêm " style="width:100px; height:20px;"/>
    </p>
}
</div>